package com.stud.common.core.mybatis;

import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.stud.common.core.web.domain.BaseEntity;

import java.util.List;

/**
 * @author Stud
 * @title mybatis-plus二次封装父类
 * @desription 用于扩展
 * @data 2022-08-20 10:53
 */
public class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> extends ServiceImpl<M, T> implements BaseService<T> {

    /**
     * 高效批量插入
     *
     * @param entityList 实体对象
     */
    @Override
    public Integer insertBatchFast(List<T> entityList) {
        return baseMapper.insertBatchFast(entityList);
    }

    /**
     * 根据 ID 修改,属性为空则赋值为空
     *
     * @param entity 实体对象
     */
    @Override
    public boolean updateFullById(T entity) {
        log.debug(JSON.toJSONString(entity));
        return baseMapper.updateFullById(entity);
    }
}
